package com.xfp.controller;

import com.xfp.pojo.dto.OrderQueryDto;
import com.xfp.pojo.vo.GoodsList;
import com.xfp.pojo.vo.OrderQueryVo;
import com.xfp.service.OrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/api/order-service")
@Api(tags = "订单管理")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/order/search")
    @ApiOperation("订单搜索")
    public OrderQueryVo orderQuery(OrderQueryDto dto){
        log.info("订单搜索");
        OrderQueryVo vo = orderService.orderQuery(dto);
        return vo;
    }

    @GetMapping("/report/skuCollect/{innerCode}/{start}/{end}")
    @ApiOperation("获取售货机商品销量")
    public List<GoodsList> getSkuCollect(@PathVariable String innerCode,@PathVariable String start ,@PathVariable String end){
        log.info("获取售货机商品销量：{},{},{}",innerCode,start,end);
        return orderService.getSkuCollect(innerCode,start,end);
    }

}
